Generally a microcomputer which incorporates a ROM therein has a mode for outputting data stored in the ROM (described as ROM data) for checking whether data such as a program has been correctly written in the ROM or not. When this mode is selected, as shown in FIG. 9, data corresponding to an address sent via an address bus from a central processing unit (described as CPU) 11 of the microcomputer is read from ROM 13, and the data is transferred via a data bus 14 to an output port 15, and is outputted to the outside.
FIG. 10 is a flow chart showing a sequence of operations for checking ROM data. When checking of ROM is started, the CPU 11 executes a program using a MOV instruction, and with this operation, the ROM data is outputted by byte to the output port 15 (step S1). The outputted ROM data is compared with an expected value for the data, and when the ROM data is coincident with the expected value it is determined that the data is correct (step S2). When comparison of all of the ROM data with the respective expected values is over (step S3), this checking operation ends. The program using the MOV instruction is generally stored in a random access memory (described as RAM hereinafter) not shown in the FIG. 9.
However, as a mode is prepared as described above for outputting ROM data to the outside, a third party can easily obtain information written in the ROM by using this mode, hence it is difficult to maintain security of the ROM data.
It is conceivable to protect the ROM data in order to prevent it from being read out from the outside, but in that case it is impossible to read out ROM data when testing the ROM or analysis of any faulty section, which is inconvenient for a user.